package ru.butt.zasada;

import android.os.Bundle;
import android.view.KeyEvent;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
/**
 * Created by IntelliJ IDEA.
 * User: ARaygorodskiy
 * Date: 08.07.2009
 * Time: 18:26:39
 */
public class MapViewer extends MapActivity {
	private MapView map;
	private MapController mc;
	private static int zoomValue = 1;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        map = (MapView) findViewById(R.id.map);
        mc = map.getController();
        mc.setZoom(zoomValue);
    }

	@Override
	public boolean dispatchKeyEvent(KeyEvent event) {
		if(event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP) {
			zoomValue = zoomValue + 1;
			mc.setZoom(zoomValue);
		} else if(event.getKeyCode() == KeyEvent.KEYCODE_DPAD_DOWN) {
			zoomValue = zoomValue - 1;
			mc.setZoom(zoomValue);
		} else if(event.getKeyCode() == KeyEvent.KEYCODE_DPAD_LEFT) {
			map.setSatellite(false);
		} else if(event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT) {
			map.setSatellite(true);
		}
		return super.dispatchKeyEvent(event);
	}

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}
}